package com.bcx.crm.spring_boot.springTaskAsync;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Created by ys on 2018/4/8.
 */
public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TaskExecutorConfig.class);
        AsyncTaskService asyncTaskService = context.getBean(AsyncTaskService.class);
        //得到的结果是并发执行，而不是异步执行
        for (int i=0;i<10;i++){
            asyncTaskService.executeAsyncTask(i);
            asyncTaskService.executeAsyncTaskPlus(i);
        }
    }
}
